The Scandir () function returns an array that contains the files and directories in the specified path. As shown below:
Example:
Copy the Code code as follows:
Print_r (Scandir (' test_directory '));?>Output:
Copy the Code code as follows:
L Linux under Vim/usr/local/php/etc/php.inL Direct Slash Find/disable_functions enterL PRESS the I keyL Remove ScandirL Press ESC, enter wq! Save Carriage return q! Yes No save exit Lnmp Reestart Restart==========================Install thinkphp
I am developing a project using PHP, and there is a need to use Scandir to list all the documents in the specified path.
When the document name is all numeric or English, the returned array is expected, and when the document name contains Chinese,
PHP Tutorial Scandir traversal display all files and folders under the file, the method is very simple we only use the Is_dir to determine the recursive lookup once, so you can traverse the directory all the files.
Directory traversal
The Scandir () function returns an array that contains the files and directories in the specified path. As shown below:
Example:
Copy Code code as follows:
Print_r (Scandir (' test_directory '));
?>
Output:
Copy Code
Scandir () returns an array of files and directories in the specified directory.
returns an array of files and directories if successful. The failure returns FALSE.
If directory is not a directory, the e_warning level error is thrown.
Manage the newly written graph beds todayProgramThe encoding was changed to the UTF-8 format. I wanted to move closer to foreign standards. The result was just a big problem. Originally, my files were all ANSI. I used notepad to replace them with
If the Opendir (Path,context) succeeds, the function returns a directory stream, otherwise it returns false and an error. You can hide the output of an error by adding "@" in front of the function name.
The Readdir () function returns an entry in a
Summary:Four headers () are required for downloading files using PHP. For more information, see my another blog post: How PHP implements the download function? detailed Process AnalysisWhen calculating the file size, you do not need to open the file
learn PHP Object-oriented -3 carefully
Preface
Ready to write a serious study of the PHP object-oriented series, using PHP to do the Web page, do not have a deep understanding of PHP, may be Sanbang enough, do not need to have much advanced. If
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.